home *** CD-ROM | disk | FTP | other *** search
/ Tech Arsenal 1 / Tech Arsenal (Arsenal Computer).ISO / tek-07 / lantas10.zip / NCB.INT < prev    next >
Text File  |  1992-01-02  |  9KB  |  199 lines

  1.  
  2. {
  3.  ╔════════════════════════════════════════════════════════════════════════╗
  4.  ║ UNIT NCB                                                               ║
  5.  ║                                                                        ║
  6.  ║ Includefile for NCB-Datastructures                                     ║
  7.  ╟────────────────────────────────────────────────────────────────────────╢
  8.  ║ Author    : O. Rehmann                                                 ║
  9.  ║ Compiler  : Turbo Pascal 6.0                                           ║
  10.  ║ OS        : MS-DOS 5.0                                                 ║
  11.  ║ Last Edit : 02-01-1992                                                 ║
  12.  ║ Version   : 1.0                                                        ║
  13.  ╚════════════════════════════════════════════════════════════════════════╝
  14. }
  15.  
  16. UNIT NCB;
  17.  
  18. INTERFACE
  19.  
  20. USES DOS;
  21.  
  22. CONST   NETBIOS_NAME_LEN = 16;      { Length of a Netbios - Name }
  23.         NCBNAMSZ         = NETBIOS_NAME_LEN;
  24.  
  25.         NETBIOS_Int      = $5C;
  26.  
  27.  
  28. {══════════════════════════════════════════════════════════════════════}
  29. { Netbios Control Block NCB (structure definition)                     }
  30. {══════════════════════════════════════════════════════════════════════}
  31.  
  32.  
  33. TYPE
  34.  
  35.     _NCB            = RECORD
  36.  
  37.     NCB_command     : Byte;                                { command code            }
  38.     NCB_retcode     : Byte;                                { return code            }
  39.     NCB_lsn         : Byte;                            { local session number        }
  40.     NCB_num         : Byte;                            { number of our network name    }
  41.     NCB_buffer      : Pointer;                           { address of message buffer     }
  42.     NCB_length      : Word;                                 { size of message buffer        }
  43.     NCB_callname    : Array[00..(NCBNAMSZ-1)] of Char;      { blank-padded name of remote   }
  44.     NCB_name        : Array[00..(NCBNAMSZ-1)] of Char;      { our blank-padded netname      }
  45.     NCB_rto         : Byte;                            { rcv timeout/retry count        }
  46.     NCB_sto         : Byte;                             { send timeout/sys timeout      }
  47.     NCB_post        : Pointer;                            { Async notification handle     }
  48.     NCB_lana_num    : Byte;                                { lana (adapter) number        }
  49.     NCB_cmd_cplt    : Byte;                              { 0xff => commmand pending      }
  50.     NCB_reserve     : Array[00..(14-1)] of Byte;        { reserved, used by BIOS        }
  51.  
  52. END;    { _NCB }
  53.  
  54. NCB_NAME_STRING     = String[NCBNAMSZ];
  55. NCB_NAME_FIELD      = Array [00..(NCBNAMSZ-1)] of Char;
  56.  
  57. VAR   NETBIOS_INSTALLED   : BOOLEAN; { True when NETBIOS is loaded                }
  58.       DummyNCB            : _NCB;    { Dummy NCB used for installation check      }
  59.  
  60.       RECV_Timeout        : BYTE;    { Timeout values used for each call (def: 0) }
  61.       SEND_Timeout        : BYTE;
  62.  
  63.       NCBWAIT             : BOOLEAN;
  64. {══════════════════════════════════════════════════════════════════════}
  65. { Special values and constants  (Commands & return-codes)              }
  66. {══════════════════════════════════════════════════════════════════════}
  67.  
  68. {══════════════════════════════════════════════════════════════════════}
  69. { NCB Commands (function-numbers)                                      }
  70. {══════════════════════════════════════════════════════════════════════}
  71.  
  72.  
  73. CONST
  74.  
  75. { ALL OF THESE FUNCTIONS DO A WAIT AFTER EXECUTING !!!!
  76.  
  77.   You can call the same Function without a wait when adding $80 to
  78.   the function codes listet below !!!
  79.  
  80.   There is a constant for this named ASYNC
  81.  
  82.   If you use the functions defined below than you can set the boolean-
  83.   variable NCBWAIT to false or true.
  84.  
  85.   FALSE means : there is no wait (ASYNC-Mode)
  86.   TRUE  means : there is a  wait ( SYNC-Mode, default)
  87.  
  88.   Exception : RESET & CANCEL function
  89. }
  90.  
  91. NCBCALL     = $10;            { NCB CALL                }
  92. NCBLISTEN    = $11;        { NCB LISTEN                }
  93. NCBHANGUP    = $12;        { NCB HANG UP                }
  94. NCBSEND     = $14;        { NCB SEND                }
  95. NCBRECV     = $15;        { NCB RECEIVE                }
  96. NCBRECVANY    = $16;        { NCB RECEIVE ANY            }
  97. NCBCHAINSEND    = $17;        { NCB CHAIN SEND            }
  98. NCBDGSEND    = $20;        { NCB SEND DATAGRAM            }
  99. NCBDGRECV    = $21;        { NCB RECEIVE DATAGRAM                 }
  100. NCBDGSENDBC    = $22;        { NCB SEND BROADCAST DATAGRAM        }
  101. NCBDGRECVBC    = $23;        { NCB RECEIVE BROADCAST DATAGRAM    }
  102. NCBADDNAME    = $30;        { NCB ADD NAME                     }
  103. NCBDELNAME    = $31;        { NCB DELETE NAME            }
  104. NCBRESET    = $32;        { NCB RESET                }
  105. NCBASTAT    = $33;        { NCB ADAPTER STATUS            }
  106. NCBSSTAT    = $34;        { NCB SESSION STATUS            }
  107. NCBCANCEL    = $35;        { NCB CANCEL                }
  108. NCBADDGRNAME    = $36;        { NCB ADD GROUP NAME            }
  109. NCBUNLINK    = $70;        { NCB UNLINK                }
  110. NCBSENDNA    = $71;        { NCB SEND NO ACK            }
  111. NCBCHAINSENDNA    = $72;        { NCB CHAIN SEND NO ACK                }
  112.  
  113.  
  114. NCBCALLNIU    = $74;        { UB special                }
  115. NCBRCVPKT    = $78;        { UB special                }
  116. NCBTRACE        = $79;          { Token-Ring protocol trace         }
  117.  
  118. ASYNCH        = $80;        { high bit set == asynchronous      }
  119.  
  120.  
  121. {══════════════════════════════════════════════════════════════════════}
  122. { NCB return-codes (You can use these for result-checking)             }
  123. {══════════════════════════════════════════════════════════════════════}
  124.  
  125. {
  126.    NCB Return code
  127. }
  128.  
  129. NRC_GOODRET    = $00;    { good return                     }
  130. NRC_BUFLEN    = $01;    { illegal buffer length                     }
  131. NRC_BFULL    = $02;    { buffers full, no receive issued         }
  132. NRC_ILLCMD    = $03;    { illegal command                 }
  133. NRC_CMDTMO    = $05;    { command timed out                 }
  134. NRC_INCOMP    = $06;    { message incomplete, issue another command  }
  135. NRC_BADDR    = $07;    { illegal buffer address             }
  136. NRC_SNUMOUT    = $08;    { session number out of range             }
  137. NRC_NORES    = $09;    { no resource available                     }
  138. NRC_SCLOSED    = $0a;    { session closed                 }
  139. NRC_CMDCAN    = $0b;    { command cancelled                 }
  140. NRC_DMAFAIL    = $0c;    { PC DMA failed                         }
  141. NRC_DUPNAME    = $0d;    { duplicate name                 }
  142. NRC_NAMTFUL    = $0e;    { name table full                 }
  143. NRC_ACTSES    = $0f;    { no deletions, name has active sessions     }
  144. NRC_INVALID    = $10;    { name not found or no valid name         }
  145. NRC_LOCTFUL    = $11;    { local session table full             }
  146. NRC_REMTFUL    = $12;    { remote session table full             }
  147. NRC_ILLNN    = $13;    { illegal name number                 }
  148. NRC_NOCALL    = $14;    { no callname                     }
  149. NRC_NOWILD    = $15;    { cannot put * in NCB_NAME             }
  150. NRC_INUSE    = $16;    { name in use on remote adapter                 }
  151. NRC_NAMERR    = $17;    { called name cannot == name or name #       }
  152. NRC_SABORT    = $18;    { session ended abnormally             }
  153. NRC_NAMCONF    = $19;    { name conflict detected             }
  154. NRC_IFBUSY    = $21;    { interface busy, IRET before retrying       }
  155. NRC_TOOMANY    = $22;    { too many commands outstanding, retry later }
  156. NRC_BRIDGE    = $23;    { ncb_bridge field not 00 or 01                 }
  157. NRC_CANOCCR    = $24;    { command completed while cancel occurring   }
  158. NRC_RESNAME    = $25;    { reserved name specified             }
  159. NRC_CANCEL    = $26;    { command not valid to cancel             }
  160. NRC_MULT    = $33;    { multiple requests for same session         }
  161. NRC_MAXAPPS    = $36;    { max number of applications exceeded         }
  162. NRC_NORESOURCES = $38;    { requested resources are not available      }
  163. NRC_SYSTEM    = $40;    { system error                          }
  164. NRC_ROM     = $41;    { ROM checksum failure                      }
  165. NRC_RAM     = $42;    { RAM test failure                 }
  166. NRC_DLF     = $43;    { digital loopback failure             }
  167. NRC_ALF     = $44;    { analog loopback failure             }
  168. NRC_IFAIL    = $45;    { interface failure                 }
  169. NRC_ADPTMALFN    = $50;    { network adapter malfunction             }
  170.  
  171. NRC_PENDING    = $ff;    { asynchronous command is not yet finished   }
  172.  
  173.     { main user entry point for NetBIOS 3.0}
  174.  
  175.  
  176.      Maximum datagram size
  177. }
  178.  
  179. MAX_DG_SIZE     = 512;
  180.  
  181.  
  182. FUNCTION  NETBIOS_Present                                                                       : Boolean;
  183.  
  184. { General call : You must set all infos in your NCB except the Command }
  185. FUNCTION  NCB_EXECUTE(Command : Byte; VAR tNCB : _NCB)                                          : Byte;
  186.  
  187. PROCEDURE NCB_CLEAR_BLOCK(VAR tNCB : _NCB);
  188.  
  189. FUNCTION  NCB_LISTEN(VAR tNCB : _NCB)                                                           : Byte;
  190. FUNCTION  NCB_CALL(VAR tNCB : _NCB)                                                             : Byte;
  191. FUNCTION  NCB_ADD_NAME(VAR tNCB : _NCB;LocalName,RemoteName : NCB_NAME_STRING)                  : Byte;
  192. FUNCTION  NCB_DELETE_NAME(VAR tNCB : _NCB)                                                      : Byte;
  193. FUNCTION  NCB_HANG_UP(VAR tNCB : _NCB)                                                          : Byte;
  194. FUNCTION  NCB_SEND_BCST_DATAGRAM(VAR tNCB : _NCB;MSGSeg,MSGOfs,MSGLen : Word)                   : Byte;
  195. FUNCTION  NCB_RECV_BCST_DATAGRAM(VAR tNCB : _NCB;BUFSeg,BUFOfs,BUFLen : Word;UsrProc : Pointer) : Byte;
  196. FUNCTION  NCB_SEND_DATAGRAM(VAR tNCB : _NCB;MSGSeg,MSGOfs,MSGLen : Word)                        : Byte;
  197. FUNCTION  NCB_RECV_DATAGRAM(VAR tNCB : _NCB;BUFSeg,BUFOfs,BUFLen : Word;UsrProc : Pointer)      : Byte;
  198.